package cn.itcast.web.tag;

import java.io.IOException;

import javax.servlet.jsp.JspException;
import javax.servlet.jsp.tagext.BodyTag;
import javax.servlet.jsp.tagext.BodyTagSupport;
import javax.servlet.jsp.tagext.Tag;

import java.io.IOException;

import javax.servlet.jsp.JspException;
import javax.servlet.jsp.tagext.BodyTag;
import javax.servlet.jsp.tagext.BodyTagSupport;
import javax.servlet.jsp.tagext.Tag;

//修改标签体
public class TagDemo4 extends BodyTagSupport {

	//bodycontent
	@Override
	public int doStartTag() throws JspException {
		return BodyTag.EVAL_BODY_BUFFERED;  //可以执行标签体 
	}
	
	
	/***
	 * jsp内容会不会执行
	 */
	@Override
	public int doEndTag() throws JspException {
		
		//拿到标签体
		String content = this.getBodyContent().getString();
		//把内容转换成大写
		String result = content.toUpperCase();
		
		try {
			this.pageContext.getOut().write(result);
		} catch (IOException e) {
			throw new RuntimeException(e);
		}
		
		return Tag.EVAL_PAGE;//余下jsp会被执行
	}

	

	
	
}
